<?php

namespace app\common\model\Airline;

use think\Model;
use think\Request;

// 用户模型
class Points extends Model
{
    protected $name = 'points';

    protected $autoWriteTimestamp = false;
    protected $updateTime = false;
    protected $createTime = false;

    
    // 航线表
    public function airline()
    {
        return $this->belongsTo('app\common\model\Airline\Airline', 'airline_id', 'id', [], 'LEFT')->setEagerlyType(0);
    }


    protected $append = [
        'isstart_text',  //是否航线起点
        'isend_text',  //是否航线终点
    ];

    // 是否航线起点
    public function getIsstartTextAttr($value, $data)
    {
        $list = ['0' => '否', '1' => '是'];

        $data = !empty($list[$data['is_start_point']]) ? $list[$data['is_start_point']] : '';

        return $data;
    }

    // 是否航线终点
    public function getIsendTextAttr($value, $data)
    {
        $list = ['0' => '否', '1' => '是'];

        $data = !empty($list[$data['is_end_point']]) ? $list[$data['is_end_point']] : '';

        return $data;
    }
}
